﻿<%@ Page Language="C#" MasterPageFile="~/MasterPages/MasterPage2.master" AutoEventWireup="true" CodeFile="Admin_CapNhatPhanLoai.aspx.cs" Inherits="ChucNang_Admin_Admin_CapNhatPhanLoai" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">

        .style1
        {
            width: 100%;
        }
        </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<center><h2>Cập Nhật Loại Sản Phẩm</h2></center>

    <br />
    <table class="style1">
        <tr>
            <td align="right" class="style2">
                Tên phân loại:</td>
            <td>
                <asp:TextBox ID="txtTenPhanLoai" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td align="right" class="style2">
                Hình ảnh</td>
            <td>
                <asp:Image ID="imgHinhAnh" runat="server" Height="80px" Width="80px" />
                <asp:FileUpload ID="fileuploadHinhAnh" runat="server" />
            </td>
        </tr>
        
        <tr>
            <td align="right">Thuộc tính:</td>
            <td>
            <%
                int idPhanLoai = int.Parse(Request["Id"]);
                DataDSTableAdapters.PHANLOAI_THUOCTINHTableAdapter plttAd = new DataDSTableAdapters.PHANLOAI_THUOCTINHTableAdapter();
                DataDS.PHANLOAI_THUOCTINHDataTable plttTable = plttAd.PHANLOAI_THUOCTINH_LayTheoIdPhanLoai(idPhanLoai);
                DataDSTableAdapters.THUOCTINHTableAdapter ttAd = new DataDSTableAdapters.THUOCTINHTableAdapter();
                DataDS.THUOCTINHDataTable ttTB = ttAd.GetData();
                string str = "";
                for (int i = 0; i < plttTable.Rows.Count; i++ )
                {
                    str += "<select name='select_"+plttTable[i].Id+"'>";
                    for (int j = 0; j< ttTB.Rows.Count; j++)
                    {                        
                        if(ttTB[j].Id == plttTable[i].Id_ThuocTinh)
                            str += "<option value='" + ttTB[j].Id + "' selected>"+ ttTB[j].TenThuocTinh;
                        else
                            str += "<option value='" + ttTB[j].Id + "' >" + ttTB[j].TenThuocTinh;
                        str += "</option>";    
                            
                    }
                    str += "</select><br/>";                   
                
                }
                Response.Write(str);
                
             %>
           
            </td>
        </tr>
        
        <tr>
            <td align="center" class="style2" colspan="2">
                <asp:Button ID="btnCapNhat" runat="server" 
                    Text="Cập Nhật" onclick="btnCapNhat_Click" />
&nbsp;
                <asp:Button ID="btnTroVe" runat="server" onclick="btnTroVe_Click" 
                    Text="Trở về" />
            </td>
        </tr>
    </table>
    
</asp:Content>

